
function
Scanner ( _expr )
{
var  expr = _expr.split(" ");            // convert to array
var  length = expr.length;
     // console.log ( "length   = " + length );
var  index = 0;
var  attribute;
var  last_attribute;

this.get_attribute = function()       { return  last_attribute; }

this.get = function ()
{
    var    token;

    last_attribute = attribute;
    if ( index >= length ) {
        token = END_OF_SLK_INPUT_;
    } else {
        switch ( expr[index] ) {
            case '+' :
                token = PLUS_;
                break;
            case '-' :
                token = MINUS_;
                break;
            case '*' :
                token = STAR_;
                break;
            case '/' :
                token = SLASH_;
                break;
            case '^' :
                token = CARET_;
                break;
            case '(' :
                token = LPAREN_;
                break;
            case ')' :
                token = RPAREN_;
                break;
            default : 
                token = NUMBER_;
        }
    }
    if ( token == NUMBER_ ) {
        attribute = parseFloat(expr[index]);
        if ( attribute != NaN ) {
        }
        // console.log ( "float attribute   = " + attribute );
    } else {
        attribute = token;
        // console.log ( "token attribute   = " + attribute );
    }
    ++index;

    return  token;
}

    this.peek = function ( level )   // scan next token without consuming it
    {
        var    token = 0;
    
        console.log ( "peek_token is not called in an LL(1) grammar" );
    
        return  token;
    }

}
